/*
package team.yidong.fenda.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import team.yidong.fenda.entity.Hospital;
import team.yidong.fenda.service.HospitalService;

*/
/**
 * Created by xuanlong on 2017/10/24.
 *//*

@Controller
public class ResetPasswordController {

    @Autowired
    HospitalService hospitalService;

    @RequestMapping("/resetPw")
    public String resetPw() {
        return "resetPw";
    }

    @RequestMapping("/resetPassword")
    public String resetPassword(Model model, String userName, String prePassword, String newPassword1, String newPassword2) {
        Hospital hospital = hospitalService.findHospitalBySysName(userName);
        if (hospital == null) {
            model.addAttribute("msg", "用户名不存在");
            return "redirect:/resetPw";
        } else {
            if (!hospital.getSysPassword().equals(prePassword)) {
                model.addAttribute("msg", "密码错误");
                return "redirect:/resetPw";
            } else {
                hospital.setSysPassword(newPassword1);
                hospitalService.saveHospital(hospital);
                model.addAttribute("msg", "修改成功");
                return "redirect:/login";
            }
        }
    }
}
*/
